package cn.tedu.lucky.draw.server.job.listener;

import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;

public class ActivityJobListener implements JobExecutionListener {

    @Override
    public void beforeJob(JobExecution jobExecution) {
        long begin = System.currentTimeMillis();
        jobExecution.getExecutionContext().putLong("begin",begin);
        System.out.println("=================【开始执行：当前时间是"+begin+"】============================");
    }

    @Override
    public void afterJob(JobExecution jobExecution) {
        long end = System.currentTimeMillis();
        long begin = jobExecution.getExecutionContext().getLong("begin");
        System.out.println("=================【共消耗时间："+(end-begin)+"】==============================");

    }
}
